<?php

class DotGenerator extends FileScanner
{
	public function __construct($path)
	{
		parent::__construct($path);		
	}
	
	protected function generateRows()
	{
		$rows = Array();
		foreach(Map::$fieldMap as $entityName => $fields)
		{
			
			foreach($fields as $fieldName => $field)
			{	
				if($field instanceof ManyToOne || $field instanceof ManyToMany)
					$rows[] = "\t".$entityName." -> ".$field->class;
			}			
		}
		//var_dump(Map::$fieldMap);die;
		
		return implode("\n",$rows);
	}
	
	public function generateDotString()
	{
		$rows = $this->generateRows();
		return <<<HEREDOC
digraph G {
{$rows}
}
HEREDOC;
	}
}

?>